<template>
  <div class="layui-tab-content">
    <a href="@{/admin_course_add}">添加课程</a>

    <table class="user-table">
      <thead>
      <tr>
        <th>课程代码</th>
        <th>课程名称</th>
      </tr>
      </thead>
      <tbody v-for="c in courses" :key="c.courseId">
      <tr>

        <td v-text="c.courseCode">1</td>
        <td v-text="c.courseName">小明</td>
        <td class="admin-manage">
          <a  href="javascript:void(0)" @click="courseRevise(c.courseId)">
            修改课程名称
          </a>
        </td>


      </tr>

      </tbody>
    </table>


  </div>
</template>

<script>
export default {
  name: "courseList",
  data() {
    return {
      courses :null
    }

  },
  created() {
    this.initCourse();
  },
  methods:{
    initCourse() {
      const that = this;
      that.axios.get("/api/course_list").then(({ data }) => {
        this.courses = data.data;
      });
    },
    courseRevise(id){
      this.$router.push({ path: "/CourseRevise/"+id });
    }
  }
}
</script>

<style scoped>

</style>
